package com.news.controller;

import com.news.entity.News;
import com.news.entity.Type;
import com.news.service.AllInOneService;
import com.news.utils.NewsJSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zslaa
 * @version 1.0
 * @date 2020/2/28 12:22
 * FileName: TypeController
 * @Description:
 */
@RestController
@RequestMapping("/type")
public class TypeController {
    @Autowired
    private AllInOneService allInOneService;

    @GetMapping("/all")
    @ResponseBody
    public NewsJSONResult all() {
        List<Type> allTypes = allInOneService.queryAllTypes();
        return NewsJSONResult.ok(allTypes);
    }
}
